import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../views/layout/Layout'
const cainiao = resolve => require(['../views/cainiao/index'], resolve)
const ERP = resolve => require(['../views/ERP/index'], resolve)
const editor = resolve => require(['../views/editor/index'], resolve)
const echarts = resolve => require(['../views/echarts/echarts'], resolve)
const pie = resolve => require(['../views/echarts/pie'], resolve)
const highcharts = resolve => require(['../views/echarts/highcharts'], resolve)
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Layout',
      component: Layout
    },
    {
      path: '/cainiao',
      component: Layout,
      redirect: 'noredirect',
      name: 'cainiao',
      icon: 'cainiao',
      noDropdown: true,
      children: [{ path: '/', component: cainiao, name: '导出excel' }]
    },
    {
      path: '/erp',
      component: Layout,
      redirect: 'noredirect',
      name: 'ERP',
      icon: 'ERP',
      noDropdown: true,
      children: [{ path: '/', component: ERP, name: '时间' }]
    },
    {
      path: '/echarts',
      component: Layout,
      redirect: '/charts/echarts',
      name: '图表',
      icon: 'echarts',
      noDropdown: true,
      children: [
        { path: '/echarts', component: echarts, name: '数据表' },
        { path: '/pie', component: pie, name: '饼状图' },
        { path: '/highcharts', component: highcharts, name: '线图' }
      ]
    },
    {
      path: '/editor',
      component: Layout,
      redirect: 'noredirect',
      name: 'editor',
      icon: 'editor',
      noDropdown: true,
      children: [{ path: '/', component: editor, name: '编辑器' }]
    }
  ]
})
